﻿using System;

namespace VisualWip.Core.Columns
{
    public class UriColumn : Column
    {
        private Uri _uri;

        public UriColumn()
        {
            Height = 480;
            Width = 640;
            PositionY = 0;
        }

        public Uri Uri
        {
            get { return _uri; }
            set
            {
                if (value != _uri)
                {
                    _uri = value;
                    OnPropertyChanged(this, () => Uri);
                }
            }
        }

        public override PersistenceTree Persist(string name)
        {
            PersistenceTree persistenceTree = base.Persist(name);
            persistenceTree.Add("Uri", Uri.ToString());
            return persistenceTree;
        }

        public override void Load(PersistenceTree settings)
        {
            base.Load(settings);
            Uri = new Uri(settings.Get<string>("Uri",string.Empty));
        }

        public override void DoRefresh()
        {
        }
    }
}